package top.rzhsky.bean;

import java.io.Serializable;
import java.util.*;

/**
 * @author rzh
 * time 2018-11-02 8:25
 */
public class Message implements Serializable{
    /**
     * 发送方
     */
    private User from;

    /**
     * 目的方
     */
    private User to;

    /**
     * 类型
     */
    private Type type;

    /**
     * 信息
     */
    private String context;

    /**
     * 文件名
     */
    private String fileName;

    /**
     * 在线用户
     */
    private List<User> list;

    /**
     * 文件内容
     */
    private byte[] fileContext;

    private Set<User> hasRegister;
    private Map<String, List<MessageRecord>> listMap;

    public Message() {
    }

    public Message(User from, User to, Type type, String context) {
        this.from = from;
        this.to = to;
        this.type = type;
        this.context = context;
    }

    public void setUserList(HashMap<String, User> userList) {
        this.list = new ArrayList<>(userList.values());
    }

    public List<User> getUserList() {
        return list;
    }

    public User getFrom() {
        return from;
    }

    public void setFrom(User from) {
        this.from = from;
    }

    public User getTo() {
        return to;
    }

    public void setTo(User to) {
        this.to = to;
    }

    public Type getType() {
        return type;
    }

    public void setType(Type type) {
        this.type = type;
    }

    public String getContext() {
        return context;
    }

    public void setContext(String context) {
        this.context = context;
    }

    public Map<String, List<MessageRecord>> getListMap() {
        return listMap;
    }

    public void setListMap(Map<String, List<MessageRecord>> listMap) {
        this.listMap = listMap;
    }

    public Set<User> getHasRegister() {
        return hasRegister;
    }

    public void setHasRegister(Set<User> hasRegister) {
        this.hasRegister = hasRegister;
    }

    public String getFileName() {
        return fileName;
    }

    public void setFileName(String fileName) {
        this.fileName = fileName;
    }

    public byte[] getFileContext() {
        return fileContext;
    }

    public void setFileContext(byte[] fileContext) {
        this.fileContext = fileContext;
    }

    @Override
    public String toString() {
        return "Message{" +
                "from=" + from +
                ", to=" + to +
                ", type=" + type +
                ", context='" + context + '\'' +
                '}';
    }
}
